package demo1;
class Base{
    public int a = 1;
    public int b = 2;
}
class Derived extends Base{
    public int a = 3;
    public int c = 4;
    public void method(){
       /* a = 10;//这里的a
        b = 20;
        c = 30;*/
        System.out.println(a);//3
        //当子类和父类是 同名的成员变量是=时 优先访问子类的
        //如果要访问父类的 使用super
        System.out.println(b);//2
        System.out.println(c);//4
    }
}

public class Test2 {
    public static void main(String[] args) {
        Derived derived = new Derived();
        derived.method();
        System.out.println();

    }
}
